<template>
  <div>
      <h1>test-watch</h1>

  </div>
</template>

<script>
import { defineComponent } from "@vue/runtime-core";
import { ref,watch } from "vue";

export default defineComponent({
    setup() {
        console.log("---watch---")
        const num = ref(0);
        watch(num,(newNum,oldNum)=>{
            console.log("newNum",newNum);
            console.log("oldNum",oldNum);
        })
        setTimeout(()=>{
            num.value = 666;
        },1000)
    }
})
</script>

<style>

</style>